package 对象_序列专属;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;

/**
一次序列化多个对象？
	可以，将对象放到集合中，序列化集合
 */
public class ObjectOutputStreamTest02 {

	public static void main(String[] args) throws IOException{
		
		List<Student> list = new ArrayList<Student>();
		list.add(new Student("Tom",20));
		list.add(new Student("Iven",27));
		list.add(new Student("jack",35));
		list.add(new Student("charlie",56));
		
		ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("Student"));
		
		//序列化一个集合
		oos.writeObject(list);
		
		oos.flush();
		
		oos.close();

	}

}
